﻿<Window x:Class="Bazookabird.Wpf.Builds.BuildListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Common="clr-namespace:Bazookabird.Common;assembly=Bazookabird.Common" 
             mc:Ignorable="d" 
             Height="200" Width="500"
             WindowStyle="ToolWindow"
             Title="{Binding DisplayName}">
    <Window.Resources>
        <DataTemplate x:Key="BuildHandlerTemplate">
            <TextBlock Text="{Binding Name}" />
        </DataTemplate>
        <DataTemplate DataType="{x:Type Common:BuildDefinitionWrapper}">
            <TextBlock Text="{Binding Name, FallbackValue='no name'}" />
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />            
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <ListBox Grid.Column="0" 
                 HorizontalAlignment="Stretch"
                 ItemsSource="{Binding BuildHandlers}" 
                 SelectedItem="{Binding SelectedBuildHandler}" 
                 Background="Transparent"                  
                 ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                 ItemTemplate="{StaticResource BuildHandlerTemplate}" 
                 VerticalAlignment="Stretch" />        
    <GridSplitter Grid.Column="1" Width="4" VerticalAlignment="Stretch" ResizeBehavior="PreviousAndNext" ResizeDirection="Columns" />
        <ListBox Grid.Column="2" ItemsSource="{Binding BuildCollection, FallbackValue=''}" 
                 SelectedItem="{Binding SelectedBuildDefinition}"
                 ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                 Background="Transparent">
        </ListBox>
        <Button Name="AddBuildHandler" Content="Add view" Grid.ColumnSpan="3" Grid.Row="1" HorizontalAlignment="Center" Width="100" />
    </Grid>
</Window>